# 4.py
# 当前工作目录

import os
 
# 获取当前工作目录
current_directory = os.getcwd()
file_name = 'index.py'
abs_file_name = os.path.abspath(file_name)
  
print(current_directory)

# 判断路径是否存在
path_exists = os.path.exists(current_directory)
path_exists2 = os.path.exists(file_name)

print(path_exists)
print(path_exists2)
   
# 获取目录名和文件名
dirname, filename = os.path.split(abs_file_name)
print(dirname,filename)

# 连接路径
full_path = os.path.join(dirname, filename)
print(full_path)

# 获取文件大小
file_size1 = os.path.getsize(abs_file_name)
file_size2 = os.path.getsize(file_name)

print(file_size1)
print(file_size2)


